package com.jy.api.dao;

import com.jy.api.domain.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface UserDao extends CrudRepository<User, String> {

    /**
     * 通过电话号码查询用户
     *
     * @param username
     * @return
     */
    User findByUsername(String username);

    /**
     * 获取账号对应name
     *
     * @param username
     * @return
     */
    @Query(value = "select `name` from `user` where username=?1 limit 1", nativeQuery = true)
    List<Object> getName(String username);


}
